import java.util.*;

public class Main2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int L = sc.nextInt();
        int S = sc.nextInt();
        Point[] pointA = new Point[n];
        for (int i = 0; i < n; i++) {
            pointA[i] = new Point(sc.nextInt(), sc.nextInt());
        }
        ArrayList<Point> pointB = new ArrayList<>();
        int cnt = 0;
        for (int i = 0; i < S + 1; i++) {
            for (int j = 0; j < S + 1; j++) {
                int temp = sc.nextInt();
                if (temp == 1) {
                    pointB.add(new Point(j, S - i));
                    cnt++;
                }
            }
        }
        sc.close();
        // System.out.println(Arrays.toString(pointA));
        // System.out.println(pointB);
        int res = 0;
        for (int i = 0; i < pointA.length; i++) {
            boolean flag1 = true;// 1位置是否对应
            int x = pointA[i].x;
            int y = pointA[i].y;
            long xright = x + S;
            long yup = y + S;
            ArrayList<Point> list = new ArrayList<>();
            for (int j = 0; j < pointA.length; j++) {
                if (pointA[j].x >= x && pointA[j].x <= xright && pointA[j].y >= y && pointA[j].y <= yup) {
                    list.add(pointA[j]);
                }
            }
            if (list.size() == cnt) {// 数目相等后再比较位置
                for (Point point : list) {
                    long tempx = point.x - x;
                    long tempy = point.y - y;
                    boolean flag2 = false;
                    for (int k = 0; k < pointB.size(); k++) {
                        if (tempx == pointB.get(k).x && tempy == pointB.get(k).y) {
                            flag2 = true;
                            break;
                        }
                    }
                    flag1 = flag2 && flag1;
                }
                if (flag1==true) {
                    if (xright <= L&&yup <= L) {// 未越界
                        res++;
                    }
                }
            }
        }
        System.out.print(res);
    }

}

class Point {
    int x;
    int y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public String toString() {
        return "x=" + this.x + " y=" + this.y;
    }

}